import request from '@/utils/request'

// 用户登录
export const userLogin = (data) => request.post('/users/login', data)

// 用户注册
export const userRegister = (data) => request.post('/users/register', data)

// 用户退出
export const userLogout = () => request.post('/users/logout')

// 更新用户信息
export const updateUser = (userId, data) => request.put(`/users/${userId}`, data)

// 创建消防员账号
export const createEmployee = (data) => request.post('/employees', data)

// 更新消防员在职状态
export const updateEmployeeStatus = (employeeId, status) =>
  request.put(`/employees/${employeeId}/employment-status`, null, {
    params: { status }
  })

// 管理员更新消防员信息
export const updateEmployee = (employeeId, data) => request.put(`/employees/${employeeId}`, data)

// 批量获取消防员信息
export const getEmployees = (ids) =>
  request.get('/employees', {
    params: { ids }
  })

// 获取在线消防员信息
export const getOnlineEmployees = (page = 1, size = 10, name) =>
  request.get('/employees/online', {
    params: { page, size, name }
  })

// 分页获取消防员信息
export const queryEmployeeByPage = (data) => request.post('/employees/page', data)

export const resetEmployeePassword = (employeeId) =>
  request.put(`/employees/reset-password/${employeeId}`)
